import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx';
import monacoEditorPlugin from 'vite-plugin-monaco-editor'
import { loadEnv } from 'vite'

// https://vitejs.dev/config/
export default defineConfig({
  base: './',
  plugins: [
    vue(),
    vueJsx(),
    /* @ts-ignore */
    monacoEditorPlugin.default({
      languageWorkers: ['editorWorkerService', 'typescript', 'json', 'html']
    })
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  server: {
    // 本地跨域代理. 目前注释的原因：暂时没有用途，server 端已经支持跨域
    proxy: {
      ['/admin-api']: {
        target:'http://192.168.10.82:48080/',
        ws: false,
        changeOrigin: true,
        rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''),
      },
    },
  },
})
